import requests

from common.ihrm_id import get_ihrm_id
from common.ihrm_token import get_ihrm_token
from config import HTTP


class IhrmEmp:
    @classmethod
    def ihrm_emp_insert_api(cls,jsondata):
        resp = requests.post(url=f"{HTTP}/api/sys/user",
                             headers={"Authorization": get_ihrm_token()},
                             json=jsondata)
        return resp

    @classmethod
    def ihrm_emp_select_api(cls):
        resp = requests.get(url=f"{HTTP}/api/sys/user/{get_ihrm_id()}",
                          headers={"Authorization": get_ihrm_token()})
        return resp

    @classmethod
    def ihrm_emp_select_no_para_api(cls,empid):
        resp = requests.get(url=f"{HTTP}/api/sys/user/{empid}",
                            headers={"Authorization": get_ihrm_token()})
        return resp
    @classmethod
    def ihrm_emp_revise_api(cls,jsondata):
        resp=requests.put(url=f"{HTTP}/api/sys/user/{get_ihrm_id()}",
                          headers={"Authorization": get_ihrm_token()},
                          json=jsondata)
        return resp


    @classmethod
    def ihrm_emp_delect_api(cls,empid):
        resp=requests.delete(url=f"{HTTP}/api/sys/user/{empid}",
                             headers={"Authorization": get_ihrm_token()})
        return resp
if __name__ == '__main__':
    print(IhrmEmp.ihrm_emp_select_api().json())

